import pytest

from demo_ai_ollama.model import generate_mao_quote


class TestModel:
    """测试毛主席名言生成功能"""

    def test_generate_mao_quote(self):
        """测试生成毛主席名言"""
        quote = generate_mao_quote(port=11436)  # 使用用户指定的端口
        # 检查返回的是字符串且包含内容
        assert isinstance(quote, str)
        assert len(quote) > 0

    def test_invalid_model(self):
        """测试无效模型名称"""
        with pytest.raises(RuntimeError):
            generate_mao_quote("invalid-model-name")